// First bit of the freshness calculation, whether the dep-info file
// indicates that the target is fresh.
let dep_info = dep_info_loc(cx, pkg, target, kind);
- let are_files_fresh = use_pkg ||
- try!(calculate_target_fresh(pkg, &dep_info));
+ let mut are_files_fresh = use_pkg ||
+ try!(calculate_target_fresh(pkg, &dep_info));
// Second bit of the freshness calculation, whether rustc itself, the
// target are fresh, and the enabled set of features are all fresh.
for filename in try!(cx.target_filenames(target)).iter() {
let dst = root.join(filename);
cx.layout(pkg, kind).proxy().whitelist(&dst);
+ if are_files_fresh && !dst.exists() {
+ are_files_fresh = false;
+ }
if target.get_profile().is_test() {
cx.compilation.tests.push((target.get_name().into_string(), dst));
assert_that(&p.bin("foo"), existing_file());
assert_that(&p.bin("examples/foo"), existing_file());
})
+
+test!(compile_then_delete {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [package]
+ name = "foo"
+ version = "0.0.1"
+ authors = []
+ "#)
+ .file("src/main.rs", "fn main() {}");
+
+ assert_that(p.cargo_process("run"), execs().with_status(0));
+ assert_that(&p.bin("foo"), existing_file());
+ fs::unlink(&p.bin("foo")).unwrap();
+ assert_that(p.process(cargo_dir().join("cargo")).arg("run"),
+ execs().with_status(0));
+})